namespace WebRtcProject.Models.Messages
{
    public class RoomEventMessage : BaseMessage
    {
        public string RoomId { get; set; } = string.Empty;
        public string RoomName { get; set; } = string.Empty;
        public string EventType { get; set; } = string.Empty; // created, deleted, user_joined, user_left
        public string? UserId { get; set; }
        public string? UserName { get; set; }
        public int UserCount { get; set; }
        public int MaxUsers { get; set; }
        public Dictionary<string, object> Metadata { get; set; } = new();

        public RoomEventMessage()
        {
            MessageType = nameof(RoomEventMessage);
        }

        public static RoomEventMessage RoomCreated(string roomId, string roomName, int maxUsers)
        {
            return new RoomEventMessage
            {
                RoomId = roomId,
                RoomName = roomName,
                EventType = "created",
                MaxUsers = maxUsers,
                UserCount = 0
            };
        }

        public static RoomEventMessage RoomDeleted(string roomId, string roomName)
        {
            return new RoomEventMessage
            {
                RoomId = roomId,
                RoomName = roomName,
                EventType = "deleted"
            };
        }

        public static RoomEventMessage UserJoinedRoom(string roomId, string roomName, string userId, string userName, int userCount, int maxUsers)
        {
            return new RoomEventMessage
            {
                RoomId = roomId,
                RoomName = roomName,
                EventType = "user_joined",
                UserId = userId,
                UserName = userName,
                UserCount = userCount,
                MaxUsers = maxUsers
            };
        }

        public static RoomEventMessage UserLeftRoom(string roomId, string roomName, string userId, string userName, int userCount, int maxUsers)
        {
            return new RoomEventMessage
            {
                RoomId = roomId,
                RoomName = roomName,
                EventType = "user_left",
                UserId = userId,
                UserName = userName,
                UserCount = userCount,
                MaxUsers = maxUsers
            };
        }
    }
} 